package com.zsrt.java.day20161227.zp.demo01;

import java.util.Random;

public class RedEnvelopeTest {
	
	public static void main(String[] args) {
		random(5,100);
	}
	
	public static void random(int n, int L){
        Random rand = new Random();
        int temp = L;
        for(int i = 0, j; i < n-1; i++){
            j = rand.nextInt(temp-1) + 1;
            temp -= j;
            System.out.println(j);
        }
        System.out.println(temp);
    }
	
	/*
	public static void random(int people,double hb){
		Random rand = new Random();
		double temp = hb;
		for(int i=0;i<people-1;i++){
			double j =rand.nextDouble()+1;
		}
	}*/
	
}
